﻿using B.S.Filtration.ErrorCode;
using B.S.Filtration.Write.Api.Application.Command.到货检验.BasicInfoCommand;

using B.S.Filtration.Write.Api.Application.Command.到货检验.PurchaseInfoCommand;
using B.S.Filtration.Write.Api.Application.Command.到货检验.QualityLnspectionCommnad;
using B.S.Filtration.Write.Api.Application.Command.到货检验.QualityReportWorkCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Filtration.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ArrivalController : ControllerBase
    {
        private readonly IMediator mediator;

        public ArrivalController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 到货信息基础表添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddBasicInfo(AddBasicInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 到货信息基础表删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelBasicInfo([FromQuery]DelBasicInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        ///  到货信息基础表修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateBasicInfo(UpdateBasicInfoCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 到货信息明细表添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddPurchaseInfo(AddPurchaseInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 到货信息明细表删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelPurchaseInfo([FromQuery] DelPurchaseInfoCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 到货信息明细表修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdatePurchaseInfo(UpdatePurchaseInfoCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 质检工单添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddQualityLnspection(AddQualityLnspectionCommnad request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 质检工单删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelQualityLnspection([FromQuery] DelQualityLnspectionCommnad request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 质检工单修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateQualityLnspection(UpdateQualityLnspectionCommnad request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 质检报工添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddQualityReportWork(AddQualityReportWorkCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 质检报工删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelQualityReportWork([FromQuery]DelQualityReportWorkCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 质检报工修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateQualityReportWork(UpdateQualityReportWorkCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
    }
}
